package com.mdnote.jianzhi_offer.recursion;

/**
 * @author Rhythm-2019
 * @version 1.0
 * @date 2020/10/12 0012
 * @description 爬楼梯
 */
public class Offer10II {

    public int numWays(int n) {
        if (n <= 1) {
            return 1;
        }
        int i = 1, j = 1, k = 0;
        for (int t = 2; t < n + 1; t++) {
            k = (i + j) % 1000000007;
            i = j;
            j = k;
        }
        return k;
    }
}
